package com.shuzixiangcun.service.admin;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.shuzixiangcun.entity.Orders;
import com.shuzixiangcun.dao.OrdersDao;
import com.shuzixiangcun.entity.Users;
import com.shuzixiangcun.service.admin.OrdersServiceImpl;
import org.springframework.stereotype.Service;


import javax.annotation.Resource;
import java.util.List;

/**
 * 订单表(Orders)表服务实现类
 *
 * @author makejava
 * @since 2024-06-24 08:26:16
 */
@Service
public class OrdersServiceImpl {
    @Resource
    private OrdersDao ordersDao;

    /**
     * 通过ID查询单条数据
     *
     * @param orderId 主键
     * @return 实例对象
     */

    public Orders queryById(Integer orderId) {
        return this.ordersDao.queryById(orderId);
    }

    /**
     * 分页查询
     *
     * @param orders      筛选条件
     * @param pageRequest 分页对象
     * @return 查询结果
     */

    /**
     * 新增数据
     *
     * @param orders 实例对象
     * @return 实例对象
     */

    public int insert(Orders orders) {

        return this.ordersDao.insert(orders);
    }

    /**
     * 修改数据
     *
     * @param orders 实例对象
     * @return 实例对象
     */

    public int update(Orders orders) {

        return this.ordersDao.update(orders);
    }

    /**
     * 通过主键删除数据
     *
     * @param orderId 主键
     * @return 是否成功
     */

    public int deleteById(Integer orderId) {
        return this.ordersDao.deleteById(orderId) ;
    }


    public List<Orders> showList(String search) {
        return this.ordersDao.showList(search);
    }

    public PageInfo<Orders> getPageInfo(Integer pageNo, Integer pageSize,String search) {
        PageHelper.startPage(pageNo, pageSize,true);
        List<Orders> mangerList=ordersDao.showList(search);
        return new PageInfo<Orders>(mangerList);
    }


}
